package com.haonan.springboot_exercise.bean.pojo;

import lombok.Data;
import lombok.NonNull;
import org.springframework.boot.context.properties.bind.DefaultValue;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

/**
 * 邮件，从前端传来的表单，to是String[]
 * @author haonan
 * @date 2021/4/13 16:19
 **/
@Data
public class MyMailMessage{

    private String from;

    private String[] to;

    private String sent_time;

    private String subject;

    private String text;

    public MyMailMessage (){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        this.sent_time = simpleDateFormat.format(new Date());
    }

    @Override
    public String toString(){
        return "from=" + this.from + "; " +
//                "to=" + StringUtils.arrayToCommaDelimitedString(this.to) + "; " +
                "to=" + Arrays.toString(this.to) + "; " +
                "sentDate=" + this.sent_time + "; " +
                "subject=" + this.subject + "; " +
                "text=" + this.text;
    }
}
